package framework.mashup;

import java.net.URL;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class ReportClient extends Application {
	public static void main(String[] arg) {
		Application.launch(arg);
	}
	
	@Override
	public void start(Stage primaryStage) throws Exception {
		AnchorPane root = new AnchorPane();
		Scene scene = new Scene(root, 400 , 300);
		primaryStage.setScene(scene);
		primaryStage.show();
		
		WebView webView = new WebView();
		final WebEngine webEngine = webView.getEngine();
		URL urlHello = getClass().getResource("Chart.html");
		
        webEngine.load(urlHello.toExternalForm());
        root.getChildren().add(webView);
        webView.prefHeightProperty().bind(root.heightProperty());
        webView.prefWidthProperty().bind(root.widthProperty());
        
        Button button = new Button("Button");
        root.getChildren().add(button);
        button.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
				webEngine.executeScript("draw()");
			}
        	
        });
	}
}
